﻿<fundamentals:OfficeWindow x:Class="Daytimer.Controls.EventRecurrence"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:ext="clr-namespace:Microsoft.Windows.Shell;assembly=Microsoft.Windows.Shell"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Daytimer.Controls"
		xmlns:fundamentals="clr-namespace:Daytimer.Fundamentals;assembly=Daytimer.Fundamentals"
		xmlns:src="clr-namespace:Daytimer.Functions;assembly=Daytimer.Functions" ShowActivated="True"
		Title="Event Recurrence" Width="600" Height="540" WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
		ResizeMode="NoResize">
	<!--<ext:WindowChrome.WindowChrome>
		<ext:WindowChrome GlassFrameThickness="0" CornerRadius="0" CaptionHeight="100" />
	</ext:WindowChrome.WindowChrome>-->
	<Window.Resources>
		<Style x:Key="Header" TargetType="TextBlock">
			<Setter Property="FontSize" Value="15" />
			<Setter Property="Margin" Value="15" />
			<Setter Property="Grid.ColumnSpan" Value="5" />
			<Setter Property="HorizontalAlignment" Value="Left" />
			<Setter Property="VerticalAlignment" Value="Center" />
			<Setter Property="IsHitTestVisible" Value="False" />
		</Style>
		<Style x:Key="IntBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
			<Setter Property="MaxLength" Value="10" />
			<Setter Property="Text">
				<Setter.Value>
					<Binding Path="Text" RelativeSource="{RelativeSource Self}">
						<Binding.ValidationRules>
							<local:PositiveInt ValidatesOnTargetUpdated="True" />
						</Binding.ValidationRules>
					</Binding>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="MonthIntBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
			<Setter Property="MaxLength" Value="2" />
			<Setter Property="Text">
				<Setter.Value>
					<Binding Path="Text" RelativeSource="{RelativeSource Self}">
						<Binding.ValidationRules>
							<local:PositiveInt Max="31" ValidatesOnTargetUpdated="True" />
						</Binding.ValidationRules>
					</Binding>
				</Setter.Value>
			</Setter>
		</Style>
	</Window.Resources>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<Grid>
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition />
			</Grid.RowDefinitions>
			<TextBlock Text="Pattern" Style="{StaticResource Header}" />
			<TabControl x:Name="tabControl" Grid.Row="1" BorderBrush="#FF8C8E94"
					ext:WindowChrome.IsHitTestVisibleInChrome="True" SelectionChanged="tabControl_SelectionChanged">
				<TabControl.Template>
					<ControlTemplate TargetType="{x:Type TabControl}">
						<Grid ClipToBounds="True" SnapsToDevicePixels="True" KeyboardNavigation.TabNavigation="Local">
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto" />
								<RowDefinition />
							</Grid.RowDefinitions>
							<TabPanel x:Name="HeaderPanel" IsItemsHost="True" Margin="15,5,0,0"
									KeyboardNavigation.TabIndex="1" Panel.ZIndex="1" HorizontalAlignment="Left" />
							<Border Grid.Row="1" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"
									VerticalAlignment="Top" Height="1" IsHitTestVisible="False" />
							<Border x:Name="ContentPanel" KeyboardNavigation.DirectionalNavigation="Contained"
									Grid.Row="1" KeyboardNavigation.TabIndex="2"
									KeyboardNavigation.TabNavigation="Local">
								<Border.RenderTransform>
									<TranslateTransform x:Name="ContentPanelTransform" />
								</Border.RenderTransform>
								<ContentPresenter x:Name="PART_SelectedContentHost"
										Content="{TemplateBinding SelectedContent}" ContentSource="SelectedContent"
										Margin="5">
									<ContentPresenter.CacheMode>
										<BitmapCache />
									</ContentPresenter.CacheMode>
								</ContentPresenter>
							</Border>
						</Grid>
					</ControlTemplate>
				</TabControl.Template>
				<TabItem x:Name="dailyTab" Header="Daily">
					<Grid>
						<Grid.RowDefinitions>
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
						</Grid.RowDefinitions>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
						</Grid.ColumnDefinitions>
						<RadioButton x:Name="dailyRadio1" GroupName="daily" HorizontalAlignment="Left"
								VerticalAlignment="Center" Content="Every" Margin="10,5" IsChecked="True"
								Checked="recurrenceData_Changed" />
						<TextBox x:Name="dailyRadio1Text1" Grid.Column="1" HorizontalAlignment="Left"
								VerticalAlignment="Center" Margin="10,5" Width="40" Height="22"
								Style="{StaticResource IntBox}" VerticalContentAlignment="Center"
								TextChanged="dailyRadio1Text1_TextChanged" />
						<TextBlock Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,5"
								Text="day(s)" IsHitTestVisible="False" />
						<RadioButton x:Name="dailyRadio2" GroupName="daily" Grid.Row="1" Grid.ColumnSpan="2"
								HorizontalAlignment="Left" VerticalAlignment="Center" Content="Every weekday"
								Margin="10,5" Checked="recurrenceData_Changed" />
					</Grid>
				</TabItem>
				<TabItem x:Name="weeklyTab" Header="Weekly" IsSelected="True">
					<Grid x:Name="weeklyGrid">
						<Grid.ColumnDefinitions>
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
						</Grid.ColumnDefinitions>
						<Grid.RowDefinitions>
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
						</Grid.RowDefinitions>
						<CheckBox x:Name="weeklySunday" Grid.Row="1" Margin="10,5" HorizontalAlignment="Left"
								VerticalAlignment="Center" Content="Sunday" Checked="recurrenceData_Changed"
								Unchecked="recurrenceData_Changed" />
						<CheckBox x:Name="weeklyMonday" Grid.Row="1" Grid.Column="1" Margin="10,5"
								HorizontalAlignment="Left" VerticalAlignment="Center" Content="Monday"
								Checked="recurrenceData_Changed" Unchecked="recurrenceData_Changed" />
						<CheckBox x:Name="weeklyTuesday" Grid.Row="1" Grid.Column="2" Margin="10,5"
								HorizontalAlignment="Left" VerticalAlignment="Center" Content="Tuesday"
								Checked="recurrenceData_Changed" Unchecked="recurrenceData_Changed" />
						<CheckBox x:Name="weeklyWednesday" Grid.Row="1" Grid.Column="3" Margin="10,5"
								HorizontalAlignment="Left" VerticalAlignment="Center" Content="Wednesday"
								Checked="recurrenceData_Changed" Unchecked="recurrenceData_Changed" />
						<CheckBox x:Name="weeklyThursday" Grid.Row="2" Margin="10,5" HorizontalAlignment="Left"
								VerticalAlignment="Center" Content="Thursday" Checked="recurrenceData_Changed"
								Unchecked="recurrenceData_Changed" />
						<CheckBox x:Name="weeklyFriday" Grid.Row="2" Grid.Column="1" Margin="10,5"
								HorizontalAlignment="Left" VerticalAlignment="Center" Content="Friday"
								Checked="recurrenceData_Changed" Unchecked="recurrenceData_Changed" />
						<CheckBox x:Name="weeklySaturday" Grid.Row="2" Grid.Column="2" Margin="10,5"
								HorizontalAlignment="Left" VerticalAlignment="Center" Content="Saturday"
								Checked="recurrenceData_Changed" Unchecked="recurrenceData_Changed" />
						<StackPanel Orientation="Horizontal" Grid.ColumnSpan="4">
							<TextBlock Margin="10,5" Text="Recur every" HorizontalAlignment="Left"
									VerticalAlignment="Center" IsHitTestVisible="False" />
							<TextBox x:Name="weeklyText1" Grid.Column="1" HorizontalAlignment="Left"
									VerticalAlignment="Center" Margin="10,5" Width="40" Height="22"
									Style="{StaticResource IntBox}" VerticalContentAlignment="Center"
									TextChanged="recurrenceData_Changed" />
							<TextBlock Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center"
									Margin="10,5" Text="week(s) on" IsHitTestVisible="False" />
						</StackPanel>
					</Grid>
				</TabItem>
				<TabItem x:Name="monthlyTab" Header="Monthly">
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
						</Grid.ColumnDefinitions>
						<Grid.RowDefinitions>
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
						</Grid.RowDefinitions>
						<StackPanel Orientation="Horizontal" Grid.ColumnSpan="5">
							<TextBlock Text="Recur every" HorizontalAlignment="Left" VerticalAlignment="Center"
									Margin="10,5" IsHitTestVisible="False" />
							<TextBox x:Name="monthlyText1" HorizontalAlignment="Left" VerticalAlignment="Center"
									Margin="10,5" Width="40" Height="22" VerticalContentAlignment="Center"
									Style="{StaticResource IntBox}" TextChanged="recurrenceData_Changed" />
							<TextBlock Text="month(s)" HorizontalAlignment="Left" VerticalAlignment="Center"
									Margin="10,5" IsHitTestVisible="False" />
						</StackPanel>
						<RadioButton x:Name="monthlyRadio1" Grid.Row="1" GroupName="monthly" Content="On day"
								Margin="10,5" HorizontalAlignment="Left" VerticalAlignment="Center" IsChecked="True"
								Checked="recurrenceData_Changed" />
						<TextBox x:Name="monthlyRadio1Text1" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left"
								VerticalAlignment="Center" Margin="10,5" Width="40" Height="22"
								Style="{StaticResource MonthIntBox}" VerticalContentAlignment="Center"
								TextChanged="monthlyRadio1Text_TextChanged" />
						<RadioButton x:Name="monthlyRadio2" Grid.Row="2" GroupName="monthly" Content="On the"
								Margin="10,5" HorizontalAlignment="Left" VerticalAlignment="Center"
								Checked="recurrenceData_Changed" />
						<ComboBox x:Name="monthlyRadio2Combo1" Grid.Row="2" Grid.Column="1" IsEditable="False"
								Width="120" Height="22" Margin="10,5" SelectedIndex="0"
								SelectionChanged="monthlyRadio2_Updated">
							<ComboBoxItem Content="first" />
							<ComboBoxItem Content="second" />
							<ComboBoxItem Content="third" />
							<ComboBoxItem Content="fourth" />
							<ComboBoxItem Content="last" />
						</ComboBox>
						<ComboBox x:Name="monthlyRadio2Combo2" Grid.Row="2" Grid.Column="2" IsEditable="False"
								Width="120" Height="22" Margin="10,5" SelectedIndex="0"
								SelectionChanged="monthlyRadio2_Updated">
							<ComboBoxItem Content="day" />
							<ComboBoxItem Content="weekday" />
							<ComboBoxItem Content="weekend day" />
							<ComboBoxItem Content="Sunday" />
							<ComboBoxItem Content="Monday" />
							<ComboBoxItem Content="Tuesday" />
							<ComboBoxItem Content="Wednesday" />
							<ComboBoxItem Content="Thursday" />
							<ComboBoxItem Content="Friday" />
							<ComboBoxItem Content="Saturday" />
						</ComboBox>
						<TextBlock Text="of the month" Grid.Row="2" Grid.Column="3" HorizontalAlignment="Left"
								VerticalAlignment="Center" Margin="10,5" IsHitTestVisible="False" />
					</Grid>
				</TabItem>
				<TabItem x:Name="yearlyTab" Header="Yearly">
					<Grid>
						<Grid.RowDefinitions>
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
						</Grid.RowDefinitions>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
						</Grid.ColumnDefinitions>
						<StackPanel Orientation="Horizontal" Grid.ColumnSpan="5">
							<TextBlock Text="Recur every" HorizontalAlignment="Left" VerticalAlignment="Center"
									Margin="10,5" IsHitTestVisible="False" />
							<TextBox x:Name="yearlyText1" HorizontalAlignment="Left" VerticalAlignment="Center"
									Margin="10,5" Width="40" Height="22" VerticalContentAlignment="Center"
									Style="{StaticResource IntBox}" TextChanged="recurrenceData_Changed" />
							<TextBlock Text="year(s)" HorizontalAlignment="Left" VerticalAlignment="Center"
									Margin="10,5" IsHitTestVisible="False" />
						</StackPanel>
						<RadioButton x:Name="yearlyRadio1" GroupName="yearly" Content="On" Margin="10,5"
								HorizontalAlignment="Left" VerticalAlignment="Center" IsChecked="True" Grid.Row="1"
								Checked="recurrenceData_Changed" />
						<ComboBox x:Name="yearlyRadio1Combo1" IsEditable="False" Width="120" Height="22" Margin="10,5"
								SelectedIndex="0" Grid.Row="1" Grid.Column="1" SelectionChanged="yearlyRadio1_Updated">
							<ComboBoxItem Content="January" />
							<ComboBoxItem Content="February" />
							<ComboBoxItem Content="March" />
							<ComboBoxItem Content="April" />
							<ComboBoxItem Content="May" />
							<ComboBoxItem Content="June" />
							<ComboBoxItem Content="July" />
							<ComboBoxItem Content="August" />
							<ComboBoxItem Content="September" />
							<ComboBoxItem Content="October" />
							<ComboBoxItem Content="November" />
							<ComboBoxItem Content="December" />
						</ComboBox>
						<TextBox x:Name="yearlyRadio1Text1" HorizontalAlignment="Left" VerticalAlignment="Center"
								Margin="10,5" Width="40" Height="22" VerticalContentAlignment="Center" Grid.Row="1"
								Grid.Column="2" Style="{StaticResource MonthIntBox}" TextChanged="yearlyRadio1_Updated" />
						<RadioButton x:Name="yearlyRadio2" GroupName="yearly" Content="On the" Margin="10,5"
								HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="2"
								Checked="recurrenceData_Changed" />
						<ComboBox x:Name="yearlyRadio2Combo1" IsEditable="False" Width="120" Height="22" Margin="10,5"
								SelectedIndex="0" Grid.Row="2" Grid.Column="1" SelectionChanged="yearlyRadio2_Updated">
							<ComboBoxItem Content="first" />
							<ComboBoxItem Content="second" />
							<ComboBoxItem Content="third" />
							<ComboBoxItem Content="fourth" />
							<ComboBoxItem Content="last" />
						</ComboBox>
						<ComboBox x:Name="yearlyRadio2Combo2" IsEditable="False" Width="120" Height="22" Margin="10,5"
								SelectedIndex="0" Grid.Row="2" Grid.Column="2" SelectionChanged="yearlyRadio2_Updated">
							<ComboBoxItem Content="day" />
							<ComboBoxItem Content="weekday" />
							<ComboBoxItem Content="weekend day" />
							<ComboBoxItem Content="Sunday" />
							<ComboBoxItem Content="Monday" />
							<ComboBoxItem Content="Tuesday" />
							<ComboBoxItem Content="Wednesday" />
							<ComboBoxItem Content="Thursday" />
							<ComboBoxItem Content="Friday" />
							<ComboBoxItem Content="Saturday" />
						</ComboBox>
						<TextBlock Text="of" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,5"
								Grid.Row="2" Grid.Column="3" IsHitTestVisible="False" />
						<ComboBox x:Name="yearlyRadio2Combo3" IsEditable="False" Width="120" Height="22" Margin="10,5"
								SelectedIndex="0" Grid.Row="2" Grid.Column="4" SelectionChanged="yearlyRadio2_Updated">
							<ComboBoxItem Content="January" />
							<ComboBoxItem Content="February" />
							<ComboBoxItem Content="March" />
							<ComboBoxItem Content="April" />
							<ComboBoxItem Content="May" />
							<ComboBoxItem Content="June" />
							<ComboBoxItem Content="July" />
							<ComboBoxItem Content="August" />
							<ComboBoxItem Content="September" />
							<ComboBoxItem Content="October" />
							<ComboBoxItem Content="November" />
							<ComboBoxItem Content="December" />
						</ComboBox>
					</Grid>
				</TabItem>
			</TabControl>
		</Grid>
		<Grid Grid.Row="1">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition />
				<RowDefinition />
				<RowDefinition />
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition />
			</Grid.ColumnDefinitions>
			<TextBlock Text="Range" Style="{StaticResource Header}" />
			<TextBlock Text="Start" Grid.Row="1" Margin="15,5,10,5" HorizontalAlignment="Left"
					VerticalAlignment="Center" />
			<DatePicker x:Name="startDate" Grid.Row="1" Grid.Column="1" Margin="10,5" HorizontalAlignment="Left"
					VerticalAlignment="Center" Height="24" Width="130"
					SelectedDateChanged="startDate_OnSelectedDateChanged" />
			<!--<local:DatePickerControl x:Name="startDate" Grid.Row="1" Grid.Column="1" Margin="10,5"
					HorizontalAlignment="Left" VerticalAlignment="Center" Height="24" Width="130" ShowNone="False"
					OnSelectedDateChangedEvent="startDate_OnSelectedDateChangedEvent" />-->
			<RadioButton x:Name="rangeRadio1" GroupName="endrecurrence" Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="2"
					HorizontalAlignment="Left" VerticalAlignment="Center" Content="No end date" Margin="10,5"
					IsChecked="True" />
			<RadioButton x:Name="rangeRadio2" GroupName="endrecurrence" Grid.Row="2" Grid.Column="3"
					HorizontalAlignment="Left" VerticalAlignment="Center" Content="End after" Margin="10,5" />
			<TextBox x:Name="rangeRadio2Text1" Grid.Column="4" Grid.Row="2" HorizontalAlignment="Left"
					VerticalAlignment="Center" Margin="10,5" Width="40" Height="22" VerticalContentAlignment="Center"
					Style="{StaticResource IntBox}" TextChanged="rangeRadio2Text1_TextChanged" MaxLength="4" />
			<TextBlock Grid.Column="5" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center"
					Text="occurrences" Margin="10,5" IsHitTestVisible="False" />
			<RadioButton x:Name="rangeRadio3" GroupName="endrecurrence" Grid.Row="3" Grid.Column="3"
					HorizontalAlignment="Left" VerticalAlignment="Center" Content="End by" Margin="10,5" />
			<DatePicker x:Name="rangeRadio3Picker1" Grid.Row="3" Grid.Column="4" Margin="10,5" Grid.ColumnSpan="2"
					HorizontalAlignment="Left" VerticalAlignment="Center" Height="24" Width="130"
					SelectedDateChanged="rangeRadio3Picker1_SelectedDateChanged" />
			<!--<local:DatePickerControl x:Name="rangeRadio3Picker1" Grid.Row="3" Grid.Column="3" Margin="10,5"
					Grid.ColumnSpan="2" HorizontalAlignment="Left" VerticalAlignment="Center" Height="24" Width="130"
					OnSelectedDateChangedEvent="rangeRadio3Picker1_SelectedDateChanged" />-->
		</Grid>
		<Grid Grid.Row="2">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition />
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition />
			</Grid.ColumnDefinitions>
			<TextBlock Text="Exceptions" Style="{StaticResource Header}" />
			<TextBlock Grid.Row="1" Text="Skip these dates" HorizontalAlignment="Left" VerticalAlignment="Center"
					Margin="15,5,10,5" IsHitTestVisible="False" />
			<Button x:Name="skippedDatesButton" Grid.Column="1" Grid.Row="1" VerticalAlignment="Center"
					HorizontalAlignment="Left" Margin="10,5" Content="_Edit" Width="80" Height="25"
					Click="skippedDatesButton_Click" />
		</Grid>
		<Grid Background="#FFF1F1F1" Grid.Row="3" Margin="0,20,0,0">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
			</Grid.ColumnDefinitions>
			<Button x:Name="removeRecurrenceButton" VerticalAlignment="Center" Content="_Remove Recurrence" Margin="15"
					Width="150" Height="25" Click="removeRecurrenceButton_Click" />
			<Button x:Name="okButton" Grid.Column="2" VerticalAlignment="Center" Content="_OK" Margin="0,15"
					IsDefault="True" Width="80" Height="25" Click="okButton_Click" />
			<Button Grid.Column="3" VerticalAlignment="Center" Content="_Cancel" Margin="15" IsCancel="True" Width="80"
					Height="25" />
		</Grid>
	</Grid>
</fundamentals:OfficeWindow>